import React,{useState,useCallback} from 'react'
import Child from './components/Child'

export default function App() {
  const [num,setNum]=useState(0)
  console.log('-----App render-------');
  const sayHello=()=>{
    console.log('say Hello');
  }
  const sayHelloCallback=useCallback(sayHello,[])
  return (
    <div>
      <div>
        <div>{num}</div>
        <button onClick={()=>setNum(num+1)}>+</button>
      </div>
      <Child callback={sayHelloCallback}></Child>
    </div>
  )
}



